package com.nnnu.wsnackshop.pojo.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.*;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import java.util.Set;

import static io.swagger.v3.oas.annotations.media.Schema.*;

@Data
@Schema(description = "创建/更新用户 DTO")
public class AdminUserSaveDTO {
    @Schema(description = "用户名", requiredMode = RequiredMode.REQUIRED, example = "zhangsan")
    @NotBlank @Size(min = 3, max = 50)
    private String username;

    @Schema(description = "密码（仅创建时必填）", example = "Passw0rd!")
    @Size(min = 6, max = 100)
    private String password;

    @Schema(description = "昵称", example = "小张")
    @Size(max = 50)
    private String nickname;

    @Schema(description = "手机号", example = "13800138000")
    @Pattern(regexp = "^\\d{10,15}$")
    private String phone;

    @Schema(description = "头像", example = "null")
    @URL
    private String avatar;

    @Schema(description = "邮箱", example = "zhangsan@example.com")
    @Email
    private String email;

    @Schema(description = "角色ID ", example = "[11]")
    private Set<@Positive Long> roleIds;
}
